<?php


namespace core\entity;


class UserFactory {

    /**
     * 构建用户实例
     * @param string $message_type
     * @param $sender
     * @return mixed
     */
    public static function build(string $message_type, $sender) {
        $SWITCH = [
            'private' => User::class,
            'group' => GroupUser::class,
        ];
        return new $SWITCH[$message_type]($sender);
    }

}
